# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=lite-editor-plugins
pkgver=0_git20200510
_commit=3a19b1791a6a143aaad789adc18a2801875e37bb
pkgrel=0
pkgdesc="Plugins for the lite text editor"
url="https://github.com/rxi/lite-plugins"
arch="noarch"
license="MIT"
depends="lite-editor"
options="!check" # no tests
source="$pkgname-$pkgver.tar.gz::https://github.com/rxi/lite-plugins/archive/$_commit.tar.gz"
builddir="$srcdir/lite-plugins-$_commit"

# List of plugins. Installing a plugin means it's always enabled:
# https://github.com/rxi/lite/issues/60 . All functional plugins are
# listed here, language syntax plugins are always installed.
_plugins="
	autowrap
	bracketmatch
	colorpreview
	detectindent
	drawwhitespace
	eval
	gitstatus
	gofmt
	hidestatus
	indentguide
	lfautoinsert
	lineguide
	macmodkeys
	selectionhighlight
	sort
	spellcheck
	titleize
	togglesnakecamel
	unboundedscroll
	"
for _x in $_plugins; do
	subpackages="$subpackages $pkgname-$_x:_package_plugin"
done

package() {
	mkdir -p "$pkgdir"/usr/share/lite-editor/data
	cp -r plugins "$pkgdir"/usr/share/lite-editor/data
}

_package_plugin() {
	local plugin="${subpkgname#$pkgname-}"

	pkgdesc="$pkgdesc ($plugin plugin)"

	depends="$pkgname"

	mkdir -p "$subpkgdir"/usr/share/lite-editor/data/plugins
	mv "$pkgdir"/usr/share/lite-editor/data/plugins/$plugin.lua "$subpkgdir"/usr/share/lite-editor/data/plugins
}

sha512sums="026fd478d2e04af0616271f5e175cdd167b3747e9339ec4f87182509dccfdd37f3ed67256e713b251a6896c7bbfb7731ff72b5b872dc0eabcb32b28e8d86f171  lite-editor-plugins-0_git20200510.tar.gz"
